import Vue from 'vue'
import Router from 'vue-router'
//home
import birPool from '@/components/home/birPool.vue'
import building from '@/components/home/building.vue'
import buildingD from '@/components/home/buildingD.vue'
import chooseAddress from '@/components/home/chooseAddress.vue'
import chooseCityC from '@/components/home/chooseCityC.vue'
import confirmOrder from '@/components/home/confirmOrder.vue'
import goodD from '@/components/home/goodD.vue'
import home from '@/components/home/home.vue'
import homeS from '@/components/home/homeS.vue'
import homeC from '@/components/home/homeC.vue'
import newYearW from '@/components/home/newYearW.vue'
import brandListD from '@/components/home/brandListD.vue'

//login
import password from '@/components/login/password.vue'
import phone from '@/components/login/phone.vue'
import index from '@/components/login/index.vue'

//bus
import centerB from '@/components/bus/centerB.vue'
import changePassword from '@/components/bus/changePassword.vue'
import code from '@/components/bus/code.vue'
import orderData from '@/components/bus/orderData.vue'
import orderDataList from '@/components/bus/orderDataList.vue'

//center
import about from '@/components/center/about.vue'
import address from '@/components/center/address.vue'
import addressEdit from '@/components/center/addressEdit.vue'
import center from '@/components/center/center.vue'
import centerC from '@/components/center/centerC.vue'
import centerCInfo from '@/components/center/centerCInfo.vue'
import centerCPoint from '@/components/center/centerCPoint.vue'
import centerInfo from '@/components/center/centerInfo.vue'
import coupon from '@/components/center/coupon.vue'
import couponAdd from '@/components/center/couponAdd.vue'
import couponDRange from '@/components/center/couponDRange.vue'
import feedback from '@/components/center/feedback.vue'
import couponD from '@/components/center/couponD.vue'
import order from '@/components/center/order.vue'
import orderD from '@/components/center/orderD.vue'
import ticket from '@/components/center/ticket.vue'
import ticketD from '@/components/center/ticketD.vue'
import help from '@/components/center/help.vue'
import replyList from '@/components/center/replyList.vue'
import replyInfo from '@/components/center/replyInfo.vue'

Vue.use(Router)

export default new Router({
    base: '/wechat',
    routes: [{
            path: '/',
            name: 'index',
            meta: {
                title: '乐享商城',
                keepAlive: false
            },
            component: index
        },
        {
            path: '/home',
            name: 'home',
            meta: {
                title: '首页',
                keepAlive: true
            },
            component: home
        },
        {
            path: '/birPool',
            name: 'birPool',
            meta: {
                title: '生日汇',
                // keepAlive: true
            },
            component: birPool
        },
        {
            path: '/building',
            name: 'building',
            meta: {
                title: '团建',
                keepAlive: true
            },
            component: building
        },
        {
            path: '/buildingD',
            name: 'buildingD',
            meta: {
                title: '团建详情',
                keepAlive: false
            },
            component: buildingD
        },
        {
            path: '/chooseAddress',
            name: 'chooseAddress',
            meta: {
                title: '选择地址',
                keepAlive: false
            },
            component: chooseAddress
        },
        {
            path: '/chooseCityC',
            name: 'chooseCityC',
            meta: {
                title: '切换城市',
                keepAlive: false
            },
            component: chooseCityC
        },
        {
            path: '/confirmOrder',
            name: 'confirmOrder',
            meta: {
                title: '确认订单',
                keepAlive: false
            },
            component: confirmOrder
        },
        {
            path: '/goodD',
            name: 'goodD',
            meta: {
                title: '商品详情',
                keepAlive: false
            },
            component: goodD
        },
        {
            path: '/homeC',
            name: 'homeC',
            meta: {
                title: '乐享商城',
                // keepAlive: true
            },
            component: homeC
        },
        {
            path: '/homeS',
            name: 'homeS',
            meta: {
                title: '乐享商城',
                keepAlive: true
            },
            component: homeS
        },
        {
            path: '/newYearW',
            name: 'newYearW',
            meta: {
                title: '年节福利',
                keepAlive: true
            },
            component: newYearW
        },
        {
            path: '/brandListD',
            name: 'brandListD',
            meta: {
                title: '品牌列表'
            },
            component: brandListD
        },
        //login
        {
            path: '/password',
            name: 'password',
            meta: {
                title: '乐享商城',
                keepAlive: false
            },
            component: password
        }, {
            path: '/phone',
            name: 'phone',
            meta: {
                title: '乐享商城',
                keepAlive: false
            },
            component: phone
        },
        //bus
        {
            path: '/centerB',
            name: 'centerB',
            meta: {
                title: '个人中心',
                keepAlive: false
            },
            component: centerB
        },
        {
            path: '/changePassword',
            name: 'changePassword',
            meta: {
                title: '修改密码',
                keepAlive: false
            },
            component: changePassword
        },
        {
            path: '/code',
            name: 'code',
            meta: {
                title: '核销',
                keepAlive: false,
                checkWxjssdk: true
            },
            component: code
        },
        {
            path: '/orderData',
            name: 'orderData',
            meta: {
                title: '订单数据',
                keepAlive: false
            },
            component: orderData
        },
        {
            path: '/orderDataList',
            name: 'orderDataList',
            meta: {
                title: '本门店/品牌核销数据',
                keepAlive: false
            },
            component: orderDataList
        },
        //center
        {
            path: '/about',
            name: 'about',
            meta: {
                title: '关于我们',
                keepAlive: false
            },
            component: about
        },
        {
            path: '/help',
            name: 'help',
            meta: {
                title: '帮助指南',
                keepAlive: false
            },
            component: help
        },
        {
            path: '/address',
            name: 'address',
            meta: {
                title: '收货地址',
                keepAlive: false
            },
            component: address
        },
        {
            path: '/addressEdit',
            name: 'addressEdit',
            meta: {
                title: '收货地址',
                keepAlive: false
            },
            component: addressEdit
        },
        {
            path: '/center',
            name: 'center',
            meta: {
                title: '个人中心',
                keepAlive: false
            },
            component: center
        },
        {
            path: '/centerC',
            name: 'centerC',
            meta: {
                title: '个人中心',
                keepAlive: false
            },
            component: centerC
        },
        {
            path: '/replyInfo',
            name: 'replyInfo',
            meta: {
                title: '回复详情',
                keepAlive: false
            },
            component: replyInfo
        },
        {
            path: '/replyList',
            name: 'replyList',
            meta: {
                title: '平台回复',
                keepAlive: false
            },
            component: replyList
        },
        {
            path: '/centerCInfo',
            name: 'centerCInfo',
            meta: {
                title: '个人资料',
                keepAlive: false
            },
            component: centerCInfo
        },
        {
            path: '/centerCPoint',
            name: 'centerCPoint',
            meta: {
                title: '我的余点',
                keepAlive: false
            },
            component: centerCPoint
        },
        {
            path: '/centerInfo',
            name: 'centerInfo',
            meta: {
                title: '个人资料',
                keepAlive: false
            },
            component: centerInfo
        },
        {
            path: '/coupon',
            name: 'coupon',
            meta: {
                title: '我的卡券',
                keepAlive: false
            },
            component: coupon
        },
        {
            path: '/couponAdd',
            name: 'couponAdd',
            meta: {
                title: '添加乐享卡券',
                keepAlive: false,
                checkWxjssdk: true
            },
            component: couponAdd
        },
        {
            path: '/couponD',
            name: 'couponD',
            meta: {
                title: '乐享卡券详情',
                keepAlive: false
            },
            component: couponD
        },
        {
            path: '/couponDRange',
            name: 'couponDRange',
            meta: {
                title: '乐享卡券详情-限定范围',
                keepAlive: false
            },
            component: couponDRange
        },
        {
            path: '/feedback',
            name: 'feedback',
            meta: {
                title: '意见反馈',
                keepAlive: false
            },
            component: feedback
        },
        {
            path: '/order',
            name: 'order',
            meta: {
                title: '我的订单',
                keepAlive: false
            },
            component: order
        },
        {
            path: '/orderD',
            name: 'orderD',
            meta: {
                title: '订单详情',
                keepAlive: false
            },
            component: orderD
        },
        {
            path: '/ticket',
            name: 'ticket',
            meta: {
                title: '我的电子券',
                keepAlive: false
            },
            component: ticket
        },
        {
            path: '/ticketD',
            name: 'ticketD',
            meta: {
                title: '电子券详情',
                keepAlive: false
            },
            component: ticketD
        },
    ],
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition) {
            return savedPosition
        } else {
            return { x: 0, y: 0 }
        }
    }
})